<template>
	<view>
		<userindex  ref="useidex" v-if="tabberType==1"></userindex>
		<riderindex  ref="rieridex" v-if="tabberType==2"></riderindex>
		<tabBer v-if="tabberType==2" :typeOr="1"></tabBer>
		
	</view>
</template>
<script>
	import userindex from "../components/userindex/userindex.vue"
	import riderindex from "../components/riderindex/riderindex.vue"
	import tabBer from "../components/tabBar/tabBar.vue";
	export default {
		components: {userindex,riderindex,tabBer},


		data() {
			return {
				tabberType:1,
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			uni.showShareMenu({
				withShareTicket: true,
				//设置下方的Menus菜单，才能够让发送给朋友与分享到朋友圈两个按钮可以点击
				menus: ["shareAppMessage"]
			})
			if(uni.getStorageSync('tabberType')){
				this.tabberType = uni.getStorageSync('tabberType')
				if(this.tabberType == 1){
					uni.showTabBar({
					  animation: false, // 是否需要动画效果
					  success: function () {
					    console.log('TabBar has been shown successfully.');
					    // 在这里编写显示后的逻辑
					  },
					  fail: function (err) {
					    console.error('Failed to show TabBar:', err);
					  }
					});
					uni.setTabBarItem({
					    index: 0, // tabIndex，下标从0开始
					    text: '首页', // 新的文字内容
					    success: function () {
					        console.log('Tab bar item text updated successfully!');
					    },
					    fail: function (err) {
					        console.error('Failed to update tab bar item text:', err);
					    }
					});
					this.$nextTick(() => {
						this.$refs.useidex.together();
					})
				}else{
				    uni.hideTabBar()
					// 假设我们要修改第二个tab的文字
					uni.setTabBarItem({
						index: 0, // tabIndex，下标从0开始
						text: '抢单大厅', // 新的文字内容
						success: function () {
							console.log('Tab bar item text updated successfully!');
						},
						fail: function (err) {
							console.error('Failed to update tab bar item text:', err);
						}
					});
					this.$nextTick(() => {
						this.$refs.rieridex.together();
					})
				}
			}else{
				this.$nextTick(() => {
					this.$refs.useidex.together();
				})
			}
			
		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {
			if(this.tabberType == 2){
				this.$nextTick(() => {
					this.$refs.rieridex.isShow = true
					this.$refs.rieridex.upType = true
					this.$refs.rieridex.page = 1
					this.$refs.rieridex.getrh66fd9fc02c9bFunc();
				})
			}else{
				this.$nextTick(() => {
					this.$refs.useidex.together();
				})
			}
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onReachBottom(e) {
			let _this = this
			if(this.tabberType == 2){
				this.$nextTick(() => {
					if(this.$refs.rieridex.upType){
						_this.$refs.rieridex.page++
						_this.$refs.rieridex.getrh66fd9fc02c9bFunc()
					}
				})
			}
		},
		onPageScroll(e) {

		},
		methods: {
			
		}
	};
</script>
<style lang="scss" scoped>

</style>
